package com.yoomiito.app.ui.my.stock

import com.yoomiito.app.base.AppConfig
import com.yoomiito.app.base.BaseActPresenter
import com.yoomiito.app.net.YmApi

import cn.droidlover.xdroidmvp.net.ApiException
import cn.droidlover.xdroidmvp.net.ApiSubscriber
import cn.droidlover.xdroidmvp.net.BaseModel
import cn.droidlover.xdroidmvp.net.XApi
import com.yoomiito.app.model.bean.OrderList
import com.yoomiito.app.model.bean.StockBean

class StockPresenter(appConfig: AppConfig) : BaseActPresenter<StockActivity>(appConfig) {

    public fun goodsNum(type:Int) {
        YmApi.getYmService()
                .goodsNum(type,9)
                .compose(v.bindToLifecycle())
                .compose(XApi.getApiTransformerNoData<BaseModel<StockBean>>())
                .compose(XApi.getScheduler<BaseModel<StockBean>>())
                .subscribe(object : ApiSubscriber<BaseModel<StockBean>>(handleException()) {
                    override fun onSuccess(data: BaseModel<StockBean>) {
                        v.setData(data.data)
                    }

                    override fun onFail(error: ApiException) {

                    }
                })
    }

}
